﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MillerApp.CommonLib.LogProvider;
using MillerApp.CommonLib.Utility;

namespace MillerApp.Stock.Common
{
    public class LogService
    {
        /// <summary>
        /// 写日志
        /// 先简单使用文本文件存储日志，以后再导入Log4Net
        /// </summary>
        /// <param name="msg"></param>
        public static void WriteLog(string msg)
        {
            string directory = System.AppDomain.CurrentDomain.BaseDirectory;
            string filePath = System.IO.Path.Combine(directory, "log", "log.txt");
            msg = "[" + System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "]   " + msg;
            FileLogProvider log = new FileLogProvider(filePath);
            log.WriteLog(msg);

            //RuleEventRuner runer = new RuleEventRuner();
            //runer.Rule = new RuleEntity();
            //runer.Rule.AssemblyName = "MillerApp.Business.Rules.Stock.AutoGetSecuritiesInfos";
            //runer.RuleExecute();
        }
    }
}
